#INCLUDE "Protheus.Ch"

/*
ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ
Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±
Â±Â±ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÂ»Â±Â±
Â±Â±ÂºPrograma  Â³FSWUSZ0   ÂºAutor  Â³ Fabricio Zanette   Âº Data Â³  19/10/11   ÂºÂ±Â±
Â±Â±ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÂ¹Â±Â±
Â±Â±ÂºDesc.     Â³ compatibilizador para criar campos indices e tabelas     , ÂºÂ±Â±
Â±Â±Âº          Â³ relativo a tabela SZ0.                                     ÂºÂ±Â±
Â±Â±ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÂ¼Â±Â±
Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±Â±
ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ
*/
                                                              
User Function ComPad(aRecnoSm0)

Local lMark 	:= .F.
Local oOk		:= LoadBitmap( GetResources(), "CHECKED" )   //CHECKED    //LBOK  //LBTIK
Local oNo		:= LoadBitmap( GetResources(), "UNCHECKED" ) //UNCHECKED  //LBNO
Local cTexto    
Local cAux 		:= ""


Local aSx2 := {}    // Array para enviar os parametros da funÃ§Ã£o CriaSx2
Local aSx3 := {}   // Array para enviar os parametros da funÃ§Ã£o CriaSx3
Local aSix := {}   // Array para enviar os parametros da funÃ§Ã£o CriaSix
Local aSx5 := {}
Local aSx6 := {}   // Array para enviar os parametros da funÃ§Ã£o CriaSX6
Local aSx7 := {}   // Array para enviar os parametros da funÃ§Ã£o CriaSX6
Local aSxA := {}   // Array para enviar os parametros da funÃ§Ã£o CriaSXA
Local aSxB := {}   // Array para enviar os parametros da funÃ§Ã£o CriaSXB 



Local cMask:= ""



// Colocar os arrays aqui --------------------------------------------
//COLOCAR OS DADOS PARA SEREM CRIADOS CONFORME O EXEMPLO ABAIXO                

// PreparaÃ§Ã£o para chamada do CriaSx3

AADD( aSx3 , {  'CN9','','CN9_OK    ','C',1,0,'OK          ','OK          ','OK          ','                         ','                         ','                         ','                                             ','                                                                                                                                ','€€€€€€€€€€€€€€ ','                                                                                                                                ','      ',0,'þA',' ',' ','U','N','A','R',' ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                    ','                                                            ','                                                                                ','   ',' ',' ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ',' ','N','N','               '               } ) 
AADD( aSx3 , {  'SA3','','A3_ZGRUPO ','C',6,0,'Grupo       ','Grupo       ','Grupo       ','                         ','                         ','                         ','@!                                           ','                                                                                                                                ','€€€€€€€€€€€€€€ ','                                                                                                                                ','      ',0,'þA',' ',' ','U','N','A','R',' ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                    ','                                                            ','                                                                                ','   ',' ',' ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ',' ','N','N','               '               } ) 
AADD( aSx3 , {  'ACI','','ACI_ZCHAVS','C',12,0,'USO_SCRIPT  ','USO_SCRIPT  ','USO_SCRIPT  ','                         ','                         ','                         ','                                             ','                                                                                                                                ','€€€€€€€€€€€€€€ ','                                                                                                                                ','      ',0,'þA',' ',' ','U','N','A','R',' ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                    ','                                                            ','                                                                                ','   ',' ',' ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ',' ','N','N','               '               } ) 
AADD( aSx3 , {  'SE1','','E1_ZDEMAIL','D',8,0,'Dt Env Email','Dt Env Email','Dt Env Email','Data de envio de email WF','Data de envio de email WF','Data de envio de email WF','                                             ','                                                                                                                                ','€€€€€€€€€€€€€€ ','                                                                                                                                ','      ',0,'þA',' ',' ','U','N','A','R',' ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                    ','                                                            ','                                                                                ','   ',' ',' ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ',' ','N','N','               '               } ) 
AADD( aSx3 , {  'AB1','','AB1_ZDMAIL','D',8,0,'Dt Env Email','Dt Env Email','Dt Sen email','Data de envio de e-mail  ','Fecha del envio del email','Date of sending e-mail   ','                                             ','                                                                                                                                ','€€€€€€€€€€€€€€ ','                                                                                                                                ','      ',0,'þA',' ',' ','U','N','A','R',' ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                    ','                                                            ','                                                                                ','   ',' ',' ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ',' ','N','N','               '               } ) 
AADD( aSx3 , {  'ABK','','ABK_ZDMAIL','D',8,0,'Dt Env Email','Dt Env Email','Dt Snd email','Data de envio de email   ','Fecha del envio del email','Date of sending e-mail   ','                                             ','                                                                                                                                ','€€€€€€€€€€€€€€ ','                                                                                                                                ','      ',0,'þA',' ',' ','U','N','A','R',' ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                    ','                                                            ','                                                                                ','   ',' ',' ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ',' ','N','N','               '               } ) 
AADD( aSx3 , {  'AA4','','AA4_ZDMAIL','D',8,0,'Dt Env Email','Dt Env Email','Dt Snd Email','Data de Envio de email   ','Data de envio de email   ','Date of sending e-mail   ','                                             ','                                                                                                                                ','€€€€€€€€€€€€€€ ','                                                                                                                                ','      ',0,'þA',' ',' ','U','N','A','R',' ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                ','                    ','                                                            ','                                                                                ','   ',' ',' ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ',' ','N','N','               '               } ) 
   

 

// PreparaÃ§Ã£o para chamada do CriaSIX

 AADD( aSix , {  'ACH','','ACH_FILIAL+ACH_EMAIL                                                                                                                                            ','E-mail                                                                ','E-mail                                                                ','E-mail                                                                ','U','                                                                                                                                                                ','EMAIL     ','N'               } ) 
 


// Preparação para criação de gatilho
 AADD( aSx7 , {  'D7_TIPO   ','','U_MET04G01()                                                                                        ','D7_LOCDEST','P','N','   ',0,'                                                                                                    ','                                        ','U'               } ) 


// PreparaÃ§Ã£o para chamada do CriaSx6 ( Parametros. )
/*         eXemplo
AADD( aSx6 , {  '061','MV_ESTADO ','C','Sigla do estado da empresa usuaria do Sistema, pa-','Abreviatura de la estado de la empresa usuaria    ','State abbreviation referring to the system user   ','ra efeito de calculo de ICMS (7, 12 ou 18%).      ','del sistema a efectos de calculo del ICMS         ','code, for the purpose of calculating the          ','                                                  ','(7, 12 o 18%).                                    ','ICMS (7,12 OR 18%).                               ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ','U',' ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          '               } )
AADD( aSx6 , {  '061','MV_ICMPAD ','N','Informar a aliquota de ICMS aplicada em  operacoes','Informar la alicuota de ICMS aplicada en operacio-','Inform the value added tax rate, applied in the   ','dentro do estado onde a empresa esta localizada.  ','nes dentro de la provincia donde se localiza La   ','operation within the states, in which the company ','(17 ou 18) %                                      ','empresa. (17 o 18) %                              ','is localized (17 or 18%).                         ','17                                                                                                                                                                                                                                                        ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ','U',' ','                                                                                                                                ','                                                                                                                                ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          ','                                                                                                                                                                                                                                                          '               } )
  */

cLog += + chr(13) + chr(10) + "**** Atualizando Tabela: PadÃ£o" 


For a:=1 To Len(aRecnoSm0)
	
	// se a empresa nao foi selecionada apenas da um next;
	If aRecnoSm0[a][1] == .F.
		Loop
	EndIf
	
	
	cLog += + chr(13) + chr(10) + "***************************************" + chr(13) + chr(10) + "**== Empresa: "+aRecnoSm0[a][2]+ ", " + aRecnoSm0[a][3] + " ==**" + chr(13) + chr(10)
   
	//altera empresa e filial para a selecionada
	RpcClearEnv()
	RpcSetType(2)
	RpcSetEnv(aRecnoSm0[a][2], aRecnoSm0[a][4])
	                                               
	
		
	 //FunÃ§Ã£o para criar Campos no Sistema.
	 If Len(aSx3)>0
	 	Processa({||	U_CriaSx3(aSx3) ,"Atualizando SX3 "})
	 EndIf	
     //FunÃ§Ã£o para criar os Indices no sistema.
     If Len(aSix)>0
     	Processa({||	U_CriaSix(aSix) ,"Atualizando SiX "})
	 EndIf	
	 //FunÃ§Ã£o para criar os Indices no sistema.
	 If Len(aSx6)>0
	 	Processa({||	U_CriaSx6(aSx6) ,"Atualizando SX6 "})
	 EndIf
	 
	  //FunÃ§Ã£o para criar os Indices no sistema.
	 If Len(aSx6)>0
	 	Processa({||	U_CriaSX7(aSx7) ,"Atualizando SX6 "})
	 EndIf
	 
	
Next a

//Adiciona no log
U_appendToLog(cLog)


Return()

                                                              